<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="/js/jquery/jquery-2.1.4.min.js"></script>
</head>
<body>
  <form action="/yeebaoregister/register" id="form" method="post">
    <input type="submit" value="提交" id="submitButton"><br>
  </form>
  <br>
    用户主键：<input name="userId" id="userId"><br>
    真实姓名：<input name="realName" id="realName"><br>
    身份证号：<input name="idCardNo" id="idCardNo"><br>
  <input type="button" value="获取数据" id="dataButton">
</body>
<script type="text/javascript">
  $(document).ready(function() {
    $("#dataButton").on("click", obtainData);
  });
  function obtainData() {
    var data = "realName=" + $("#realName").val() + "&idCardNo=" + $("#idCardNo").val() + "&userId=" + $("#userId").val();
    $.ajax({
      type : 'POST',
      url : '/yeebaoregister/register',
      data : data,
      dataType : 'json',
      success : function(response) {
          $("#form").attr("action",response.data.redirectUrl);
          $("#form").attr("method",response.data.redirectMethod);
        $.each(response.data.redirectParameter, function(name, value) {
          $("#form").append("<input name='" + name + "' value='"+value+"'><br>");
        });
      }
    });
  }
</script>
</html>